@echo off



set THEME_REGKEY="HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders"
set PERSONALKEY="Personal"

REM Check for presence of key first.
reg query %THEME_REGKEY% /v %PERSONALKEY% 2>nul || (echo No theme name present! & exit /b 1)

REM query the value. pipe it through findstr in order to find the matching line that has the value. only grab token 3 and the remainder of the line. %%b is what we are interested in here.
set PERSONALVALUE=
for /f "tokens=2,*" %%a in ('reg query %THEME_REGKEY% /v %PERSONALKEY% ^| findstr %PERSONALKEY%') do (
    set PERSONALVALUE=%%b
)

REM Possibly no value set
if not defined PERSONALVALUE (echo No theme name present! & exit /b 1)

REM replace any spaces with +
set PERSONALVALUE=%PERSONALVALUE: =+%

md %PERSONALVALUE%\myactivities

REM open up the default browser, searching google for the theme name
REM start http://www.google.com/search?q=%PERSONALVALUE%
